#include "widget.h"
#include "ui_widget.h"
#include <QDebug>

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);

    // 设置第一个输入框的内容，姓名
    ui->lineEdit_name->setPlaceholderText("请输入姓名");
    ui->lineEdit_name->setClearButtonEnabled(true);


    // 设置第二个输入框的内容，密码
    ui->lineEdit_password->setPlaceholderText("请输入密码");
    ui->lineEdit_password->setClearButtonEnabled(true);
    ui->lineEdit_password->setEchoMode(QLineEdit::Password);

    ui->radioButton_male->setChecked(true);

    // 设置第三个输入框的内容，手机号码
    ui->lineEdit_phone_number->setPlaceholderText("请输入手机号码");
    ui->lineEdit_phone_number->setClearButtonEnabled(true);
    ui->lineEdit_phone_number->setInputMask("000-0000-0000");
}

Widget::~Widget()
{
    delete ui;
}


void Widget::on_pushButton_clicked()
{
    QString gender = ui->radioButton_male->isChecked() ? "男" : "女";
    qDebug() << "姓名：" << ui->lineEdit_name->text();
    qDebug() << "密码：" << ui->lineEdit_password->text();
    qDebug() << "性别：" << gender;
    qDebug() << "手机号码：" << ui->lineEdit_phone_number->text();
}
